<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>银联开通：跳转到银联界面开通</title>
    <script type="text/javascript" src="/static/jquery-3.2.1.min.js"></script>
    <script type="text/javascript" src="/static/md5.js"></script>
    <script type="text/javascript">


        function submitFun() {
            var key = uuid();
            var privateKey = "Apin@123456";
            var timestamp = (new Date()).valueOf();
            var sign = hex_md5(key+privateKey+timestamp);
            $.ajax({
               headers: {
                   timestamp:timestamp,
                   key:key,
                   sign:sign
               },
               type:"POST",
               url : "/v1.0/card/openCardFrontTokenBody",
               data:JSON.stringify({
                   "userUUID": $("#userUUID").val(),
                   "orderId": $("#orderId").val(),
                   "cardNo": $("#cardNo").val()
               }),
               contentType : "application/json",
               async:false,
               dataType: "html",
               success:function(data){
                   alert("1111");
                   console.info(data);
                   //$("body").html(data);
                   var OpenWindow = window.open("http://chx82112714.oicp.net/templates/empty.html");
                   OpenWindow.document.write(data);
               },
               error: function(data){
               },
               complete: function(){
               }
            });



        }



        function uuid() {
            var s = [];
            var hexDigits = "0123456789abcdef";
            for (var i = 0; i < 36; i++) {
                s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
            }
            s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
            s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
            s[8] = s[13] = s[18] = s[23] = "-";

            var uuid = s.join("");
            return uuid;
        }

    </script>
</head>
<body>
    <h1 align="center">银联开通：跳转到银联界面开通</h1>
    用户userUUID：<input id="userUUID" value="useruuiduseruuid004"><br />
    对账流水订单ID：<input id="orderId" value="orderidorderid004">（每次请求必须不一致）<br />
    测试银行卡号：<input id="cardNo" value="6216261000000000018">（不要更改）<br />



    <button name="button" onclick="submitFun()">提交</button>
</body>
</html>